package org.finmanager.budget;

import org.finmanager.core.CategoryComboBoxModel;
import org.finmanager.core.CategoryModel;
import org.finmanager.data.CategoryList;

/**
 * Created by Kelvin on 5/4/2014.
 */

//modifying the combo box of selecting category 
//adding one option for ALL CATEGORY
public class BudgetCategoryComboBoxModel extends CategoryComboBoxModel {
	public BudgetCategoryComboBoxModel(CategoryModel categoryModel) {
		super(categoryModel);
	}

	@Override
	public int getSize() {
		return super.getSize() + 1;
	}

	@Override
	public Object getElementAt(int index) {
		if (index == 0) {
			return CategoryList.ALL_CATEGORIES_FLAG;
		} else {
			return super.getElementAt(index - 1);
		}
	}
}
